$(document).ready(function() {
		var errorMessage="服务器异常，请与管理员联系。";
		
		//alert(downloadUrl);
		//$("#down").attr("href",downloadUrl);
		$('#loginForm').form({    
		    url:contextPath+"/login/loginResult.json",    
		    onSubmit: function(param){    
		    	 $.messager.progress();	// 显示进度条
		         var name=$("#username").val();
				 var pwd=$("#password").val();
		        param.name=name;
		        param.pwd=pwd;
		        //alert("in onSubmit");
		       	//console.log("in onSubmit");
		        var isValid = $('#loginForm').form('validate');
		        console.log(isValid);
				if (!isValid){
					//console.log("in close");
					$.messager.progress('close');	// 如果表单是无效的则隐藏进度条
				}
				return isValid;	// 返回false终止表单提交 */   
		    },    
		    success:function(json){    
		    	$.messager.progress('close');	//如果提交成功则隐藏进度条
		    	console.log(json);
		    	try{
		    		var data =$.parseJSON(json);
		    	}catch(error){
		    		alert(errorMessage);
		    	}
		    
		    	if(data.success){
		    		self.location.href=contextPath+"/login/index.jspPage";
		    	}else if(data.success==false){
		    		alert(data.message);
		    	}else{
		    		alert(errorMessage);
		    	}    
		    }    
		});	
		
		$("#submitBtn").on("click",function(){
			$('#loginForm').submit();
		});
		
	});